﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApplication5.settings;
using WindowsFormsApplication5.sheets;

namespace WindowsFormsApplication5
{
    public partial class MainForm : Form
    {
        ////////////////////////////////
        //Routerkonfiguration
        private string hostname;
        public string Hostname
        {
            get { return this.hostname; }
            set { this.hostname = value; }
        }

        private string motd;
        public string Motd
        {
            get { return this.motd; }
            set { this.motd = value; }
        }

        private bool console_pw_enable;
        public bool Console_pw_enable
        {
            get { return this.console_pw_enable; }
            set { this.console_pw_enable = value; }
        }

        private string console_pw;
        public string Console_pw
        {
            get { return this.console_pw; }
            set { this.console_pw = value; }
        }

        private bool telnet_pw_enable;
        public bool Telnet_pw_enable
        {
            get { return this.telnet_pw_enable; }
            set { this.telnet_pw_enable = value; }
        }

        private string telnet_pw;
        public string Telnet_pw
        {
            get { return this.telnet_pw; }
            set { this.telnet_pw = value; }
        }

        private bool user_pw_enable;
        public bool User_pw_enable
        {
            get { return this.user_pw_enable; }
            set { this.user_pw_enable = value; }
        }

        private string user_pw;
        public string User_pw
        {
            get { return this.user_pw; }
            set { this.user_pw = value; }
        }

        //Schnittstellenkonfiguratuion
        private string port;
        public string Port
        {
            get { return this.port; }
            set { this.port = value; }
        }

        private bool port_enable;
        public bool Port_enable
        {
            get { return this.port_enable; }
            set { this.port_enable = value; }
        }

        private string portdescription;
        public string Portdescription
        {
            get { return this.portdescription; }
            set { this.portdescription = value; }
        }

        private string ip;
        public string Ip
        {
            get { return this.ip; }
            set { this.ip = value; }
        }

        private string clockrate;
        public string Clockrate
        {
            get { return this.clockrate; }
            set { this.clockrate = value; }
        }

        //Statische Routerkonfiguration
        private bool defaultroute;
        public bool Defaultroute
        {
            get { return this.defaultroute; }
            set { this.defaultroute = value; }
        }
        private bool staticroute;
        public bool Staticroute
        {
            get { return this.staticroute; }
            set { this.staticroute = value; }
        }

        private string static_ip;
        public string Static_ip
        {
            get { return this.static_ip; }
            set { this.static_ip = value; }
        }

        private string static_subnetmask;
        public string Static_subnetmask
        {
            get { return this.static_subnetmask; }
            set { this.static_subnetmask = value; }
        }

        private string static_nexthopip;
        public string Static_nexthopip
        {
            get { return this.static_nexthopip; }
            set { this.static_nexthopip = value; }
        }

        //Dynamische Routerkonfiguration mit RIPv2
        private string directconnect_RIPv2;
        public string Directconnect_RIPv2
        {
            get { return this.directconnect_RIPv2; }
            set { this.directconnect_RIPv2 = value; }
        }

        private bool routingprotocol_RIPv2_enable;
        public bool Routingprotocol_RIPv2_enable
        {
            get { return this.routingprotocol_RIPv2_enable; }
            set { this.routingprotocol_RIPv2_enable = value; }
        }

        private bool autocomplete_RIPv2;
        public bool Autocomplete_RIPv2
        {
            get { return this.autocomplete_RIPv2; }
            set { this.autocomplete_RIPv2 = value; }
        }

        //Dynamische Routerkonfiguration mit OSPF
        private string authentification_OSPF;
        public string Authentification_OSPF
        {
            get { return this.authentification_OSPF; }
            set { this.authentification_OSPF = value; }
        }

        private string directconnect_OSPF;
        public string Directconnect_OSPF
        {
            get { return this.directconnect_OSPF; }
            set { this.directconnect_OSPF = value; }
        }

        private bool routingprotocol_OSPF_enable;
        public bool Routingprotocol_OSPF_enable
        {
            get { return this.routingprotocol_OSPF_enable; }
            set { this.routingprotocol_OSPF_enable = value; }
        }
        //////////////////////////////////////////////////


        public MainForm()
        {
            InitializeComponent();
        }


        public void speichernToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog opendialog = new FolderBrowserDialog();

            string savepath = "C:\\";

            //Routerkonfiguration
            Hostname = hostname_textBox.Text;
            Motd = motd_textBox.Text;
            Console_pw_enable = console_pw_checkBox.Checked;
            Console_pw = console_pw_textBox.Text;
            Telnet_pw_enable = telnet_pw_checkBox.Checked;
            Telnet_pw = telnet_pw_textBox.Text;
            User_pw_enable = user_pw_checkBox.Checked;
            User_pw = user_pw_textBox.Text;

            //Schnittstellenkonfiguratuion
            Port = port_comboBox.Text;
            Port_enable = port_checkBox.Checked;
            Portdescription = portdescription_textBox.Text;
            Ip = ip_textBox.Text;
            Clockrate = clockrate_comboBox.Text;

            //Statische Routerkonfiguration
            Defaultroute  = defaultroute_radioButton.Checked;
            Staticroute  = staticroute_radioButton.Checked;
            Static_ip = static_ip_textBox.Text;
            Static_subnetmask = static_subnetmask_textBox.Text;
            Static_nexthopip = static_nexthopip_textBox.Text;

            //Dynamische Routerkonfiguration mit RIPv2
            Directconnect_RIPv2 = RIPv2_directconnect_textBox.Text;
            Routingprotocol_RIPv2_enable = RIPv2_routingprotocol_checkBox.Checked;
            Autocomplete_RIPv2 = RIPv2_autocomplete_checkBox.Checked;

            //Dynamische Routerkonfiguration mit OSPF
            Authentification_OSPF = OSPF_authentification_textBox.Text;
            Directconnect_OSPF = OSPF_directconnect_textBox.Text;
            Routingprotocol_OSPF_enable = OSPF_routingprotocol_checkBox.Checked;    
                

            if (opendialog.ShowDialog() == DialogResult.OK)
            {
                //OutputtextBox.Text = opendialog.SelectedPath.ToString();
                savepath = opendialog.SelectedPath.ToString();

                if (hostname_textBox.Text != "")
                {
                    Config_2620 config_2620_1 = new Config_2620(this);

                    config_2620_1.create_configsheet(savepath, Hostname);
                    MessageBox.Show("Done", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("insert hostname", "insert hostname", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

        }

        private void RIPv2_directconnect_comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }


        
    }
}
